
function heartbeat_message_type_onchange(element) {
    
  if($(element).val() == 'summary') { 
    $('#type-summary-wrapper').show();  
  }
  // Single usage
  else {
    $('#type-summary-wrapper').hide();
  }  
}

$(document).ready(function() {
  heartbeat_message_type_onchange($('#heartbeat_message_type'));
});

function heartbeat_rule_get_variables(element) {
  var message_id = $(element).val();
  $.getJSON(
    Drupal.settings.basePath + 'heartbeat/heartbeat_activity_rules_default/js',
    {message_id: message_id},
    function(data) {
      $('#message-variables').hide('slow');
      $('#message-variables').find('textarea').val(data.data);
      $('#message-variables').show('slow');
    }
  );
}
